package org.apache.commons.lang;

import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.lang.text.a;

public class c {
    public static String a(Collection collection, char c) {
        return collection == null ? null : a(collection.iterator(), c);
    }

    public static String a(Iterator it, char c) {
        if (it == null) {
            return null;
        }
        if (!it.hasNext()) {
            return "";
        }
        Object next = it.next();
        if (!it.hasNext()) {
            return a.a(next);
        }
        a aVar = new a(256);
        if (next != null) {
            aVar.a(next);
        }
        while (it.hasNext()) {
            aVar.a(c);
            next = it.next();
            if (next != null) {
                aVar.a(next);
            }
        }
        return aVar.toString();
    }

    public static String a(Object[] objArr, char c) {
        return objArr == null ? null : a(objArr, c, 0, objArr.length);
    }

    public static String a(Object[] objArr, char c, int i, int i2) {
        if (objArr == null) {
            return null;
        }
        int i3 = i2 - i;
        if (i3 <= 0) {
            return "";
        }
        a aVar = new a(((objArr[i] == null ? 16 : objArr[i].toString().length()) + 1) * i3);
        for (int i4 = i; i4 < i2; i4++) {
            if (i4 > i) {
                aVar.a(c);
            }
            if (objArr[i4] != null) {
                aVar.a(objArr[i4]);
            }
        }
        return aVar.toString();
    }

    public static boolean a(String str) {
        return str == null || str.length() == 0;
    }

    public static boolean a(String str, String str2) {
        return str == null ? str2 == null : str.equals(str2);
    }

    public static boolean b(String str) {
        if (str != null) {
            int length = str.length();
            if (length != 0) {
                for (int i = 0; i < length; i++) {
                    if (!Character.isWhitespace(str.charAt(i))) {
                        return false;
                    }
                }
                return true;
            }
        }
        return true;
    }

    public static int c(String str) {
        return str == null ? 0 : str.length();
    }

    public static boolean d(String str) {
        if (str == null) {
            return false;
        }
        int length = str.length();
        for (int i = 0; i < length; i++) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
}
